<?php
/**
 * index.phtml
 * 
 * @category    Madoqua
 * @package     Module
 * @subpackage  BlogAdmin
 * @todo fix this :x
 */
?>
<div class="search-results">
    <h2>Search Results</h2>
    
    <?php if (count($this->results)) : ?>
    <ul>
        <?php foreach($this->results as $result) : ?>
        <li class="<?php echo ($result->type = 'blog_post') ? 'post' : 'page'; ?>">
        
            
            <?php if ($result->type == 'blog_post') : ?>
             
            <a href="<?php echo $this->url(array('controller' => 'post', 'action' => 'update', 'id' => $result->post_id), 'blog_admin', true); ?>">
                <?php echo $result->title; ?>
                <span class="date">
                  <?php echo $this->date($result->posted); ?>
                </span>
            </a>

            <?php else : ?>

            <a href="<?php echo $this->url(array('controller' => 'page', 'action' => 'update', 'id' => $result->page_id), 'blog_admin', true); ?>">
                <?php echo $result->title; ?>
                <span class="date">
                  <?php echo $this->date($result->posted); ?>
                </span>
            </a>

            <?php endif; ?>
                        
        </li>
        <?php endforeach; ?>
    </ul>
    
    <?php else : ?>
    <p>
        No posts or pages matched your query... please try again
    </p>
    
    <?php endif; ?>
</div>